package cn.com.nes.site.entity.em;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 工单状态
 * @author lux
 */
public enum MaintainWorkOrderStautsEnum {
    /**
     * 待处理
     */
    _0("0", "待处理"),
    /**
     * 已打卡
     */
    _1("1", "已打卡"),
    /**
     * 已完成
     */
    _2("2", "已完成"),

    /**
     * 未接单
     */
    _3("3", "未接单"),

    _4("4", "等待配件"),

    ;

    private String key;

    private String val;

    MaintainWorkOrderStautsEnum(String key, String val) {
        this.key = key;
        this.val = val;
    }
    public String getKey(){return key;}
    public String getVal() {
        return val;
    }
    public static String getVal(int key) {
        if (ObjectUtil.isNull(key)) return StrUtil.EMPTY;
        Map<String, String> map = Arrays.stream(values())
                .collect(Collectors.toMap(MaintainWorkOrderStautsEnum::getKey, MaintainWorkOrderStautsEnum::getVal));
        return map.get(String.valueOf(key));
    }



}
